package com.ruoyi;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.core.env.Environment;

/**
 * 启动程序
 *
 * @author ruoyi
 */
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@Slf4j
public class RuoYiApplication {
    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(RuoYiApplication.class);
        Environment env = app.run(args).getEnvironment();
        printServerStartupInfo(env);
    }

    private static void printServerStartupInfo(Environment env) {
        String serverPort = env.getProperty("local.server.port");
        String ansiReset = "\u001B[0m";
        String ansiGreen = "\u001B[32m";
        String ansiYellow = "\u001B[33m";
        System.out.println(
                "                                                                    \n" +
                        "                   $$$   $                  $$$                     \n" +
                        "                   $$$  $$$                 $$$                     \n" +
                        "        $$$$$$$$$$$$$$$$$$$$     $$$$$$$ $$$$$$$$$$$$        $$$    \n" +
                        "        $$$$$$$$$$$$$$$$$$$$     $$$$$$$ $$$$$$$$$$$$        $$$    \n" +
                        "        $$$        $$$             $$$      $$$   $$$        $$$    \n" +
                        "        $$$        $$$  $$$        $$$      $$$   $$$        $$$    \n" +
                        "        $$$$$$$$$$ $$$  $$$        $$$      $$$   $$$        $$$    \n" +
                        "        $$$    $$$ $$$ $$$         $$$     $$$    $$$        $$$    \n" +
                        "        $$$    $$  $$$$$$        $$$$$$$  $$$     $$$               \n" +
                        "        $$$ $ $$$  $$$$$    $    $$$$$$$ $$$      $$$        $$$    \n" +
                        "       $$$$ $$$$ $$$$$$$   $$           $$$  $$   $$$        $$$    \n" +
                        "      $$$$      $$$$  $$$$$$$          $$$    $$$$$$                \n" +
                        "                                                                    \n");
        log.info("{}启动成功，端口号：{}{}{}", ansiYellow, ansiGreen, serverPort, ansiReset);
    }
}
